package com.zzzy.controller;


import com.zzzy.po.User;
import com.zzzy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @ResponseBody
    @RequestMapping( value = "/user/{id}")
    public String getUser(@PathVariable("id") int id){

        User user = userService.findUser(id);

        return user.getName();
    }
}
